package net.schastny.shopmanager.additional;

import java.beans.PropertyEditorSupport;

import org.springframework.beans.factory.annotation.Autowired;

import net.schastny.shopmanager.domain.Contact;
import net.schastny.shopmanager.service.ContactService;

public class ContactPropertyEditor extends PropertyEditorSupport{
	@Autowired
    private ContactService contactService;
	
	  @Override
	    public void setAsText(String text) {
	//	  if (1 == 1) throw new RuntimeException(text);
		  
	        System.out.println("It's setAsText = " + text);
	        Contact contact = new Contact();
	        contact.setContactId(Integer.parseInt(text));
	        setValue(contact);	  	
	    }
	    
	    @Override
	    public String getAsText() {
	        System.out.println("It's getAsText" );
	      //  return String.valueOf(((Contact)getValue()).getContactId());
	    	return String.valueOf(2);
	    }

}
